﻿using Sys.Core.Sys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

public partial class Home : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public void SetHead(string title, string keyword, string description)
    {
        Page.Title = title;

        HtmlMeta metaKeyWords = new HtmlMeta();
        HtmlMeta metaDescription = new HtmlMeta();

        metaKeyWords.Name = "Keywords";
        metaKeyWords.Content = keyword;
        metaDescription.Name = "Description";
        metaDescription.Content = description;

        myhead.Controls.Add(metaKeyWords);
        myhead.Controls.Add(metaDescription);
    }

    public string GetLinks()
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();

        var list = DictionaryBll.I.EntitiesByTag("Link");

        sb.Append("<ul>");

        foreach (var item in list.Where(m => m.IsVisible))
        {
            sb.Append("<li><a href='" + item.Remark + "' target='_blank'>" + item.Name + "</a></li>");
        }

        sb.Append("</ul>");

        return sb.ToString();
    }
}